<template>
  <el-row class="tac">
    <el-menu
      :router="true"
      :default-active="path"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b"
    >
      <el-menu-item index="/home/pages" @click="addPath('/home/pages')">
        <i class="el-icon-menu"></i>
        <span slot="title">首页</span>
      </el-menu-item>
      <el-menu-item v-for="item in menu" :key="item.id" :index="item.path" @click="addPath(item.path)">
        <i :class="item.icon"></i>
        <span slot="title">{{item.name}}</span>
      </el-menu-item>
      
    </el-menu>
  </el-row>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
      
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    addPath(path){
      sessionStorage.setItem('path',path)
    }
  },
  computed: {
    ...mapGetters(['menu']),
    ...mapGetters(['path']),
  },
  
};
</script>

<style lang="scss" scoped>
::v-deep {
  .tac{
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
  }
  .el-menu{
      border-right: none !important;
    }
  .el-menu-vertical-demo {
    height: 100;  
  }
}
</style>